/**
 * Application Application.java
 */

package CCT220_Aula19_Exercicio03_13106;


import java.awt.Color;
import java.awt.GridLayout;

import javax.swing.ImageIcon;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButton;


/**
 * </br>******************************
 * </br>Project: CCT220
 * </br>Package: CCT220_Aula19_Exercicio03_13106
 * </br>Class: Application
 * </br>Last Change: 28/10/2011 19:45:39 by marcel
 * </br>Description:
 * </br>******************************</br>
 * 
 * @author marcel
 * @author 13106
 * 
 */
public class Application {
	private JPanel     jp;

	private JPopupMenu jppm;


	public Application() {

		this.startComponents();
		JFrame jf = new JFrame("Marcel M. Grilo - 13106");
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		jf.setLayout(new GridLayout(1, 2, 2, 2));
		jf.setSize(300, 200);
		jf.add(this.jp);
		jf.setVisible(true);
	}


	/**
	 * </br>******************************
	 * </br>Package: CCT220_Aula19_Exercicio03_13106
	 * </br>Class: Application
	 * </br>Method: startComponents
	 * </br>Last Change: 28/10/2011 19:46:55 by marcel
	 * </br>Description:
	 * </br>******************************</br>
	 * 
	 */
	private void startComponents() {

		String url = System.getProperty("user.dir")
		        + System.getProperty("file.separator") + "src"
		        + System.getProperty("file.separator")
		        + this.getClass().getPackage().getName()
		        + System.getProperty("file.separator") + "imagem"
		        + System.getProperty("file.separator") + "imagem.gif";
		this.jp = new JPanel();
		this.jp.setBackground(Color.WHITE);

		this.jppm = new JPopupMenu();
		JMenu jm = new JMenu("JMenu 01");
		jm.add(new JMenuItem("JMenuItem 02"));
		jm.add(new JMenuItem("JMenuItem 03", new ImageIcon(url)));
		this.jppm.add(new JMenuItem("JMenuItem 01"));
		this.jppm.add(new JRadioButton("JRadioButton 01"));
		this.jppm.add(new JCheckBox("JCheckBox 01"));
		this.jppm.add(jm);

		this.jp.setComponentPopupMenu(this.jppm);

	}


	public static void main(String[] args) {

		new Application();
	}
}
